package com.sm.ticket.api;

import com.sm.ticket.api.service.TicketInsideService;
import com.sm.tool.entity.dto.UpdateTicketsStatusDTO;
import com.sm.tool.entity.po.Tickets_;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * @program: practice
 * @description: 用户登录注册controller
 * @author: liqitian.
 * @create: 2019-11-15 15:13
 **/
@RestController
@RequestMapping("api/v2/ticket")
@Slf4j
public class TicketInsideApi {

    @Autowired
    private TicketInsideService ticketInsideService;

    /**
     * 模糊查询ticket code
     * @param ticketCode
     * @return
     */
    @PostMapping("/query_like_ticket_code")
    public Tickets_ query_like_ticket_code(
            @RequestParam("ticketCode") String ticketCode
    ) {
        return ticketInsideService.query_like_ticket_code(ticketCode);
    }

    /**
     * 根据ticketId list 查询ticket
     * @param ticketIds
     * @return
     */
    @PostMapping("/query_ticket_List_by_Ids")
    public List<Tickets_> queryTicketListByIds(
            @RequestParam("ticketIds") Long[] ticketIds
    ) {
        
        List<Long> resultList= new ArrayList<>(Arrays.asList(ticketIds));
        return ticketInsideService.queryTicketListByIds(resultList);
    }
}
